package com.thresh;

import com.thresh.bean.ConsumerComponent;
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;

/**
 * @Author YWB
 * @Date 2021/4/22
 * desc
 **/
public class AnnotationConsumerMain  {
    public static void main(String[] args) throws  Exception {
        System.out.println("-------------");
        AnnotationConfigApplicationContext   context = new AnnotationConfigApplicationContext(ConsumerConfiguration.class);
        context.start();
        // 获取消费者组件
        ConsumerComponent  service = context.getBean(ConsumerComponent.class);
        while(true){
            System.in.read();
            String  hello = service.sayHello("world");
            System.out.println("result:"+hello);
        }
    }
    @Configuration
    @PropertySource("classpath:/consumer.properties")
    @ComponentScan(basePackages = "com.thresh.bean")
    @EnableDubbo
    static  class  ConsumerConfiguration{

    }
}
